﻿using System;
using System.IO;

namespace Lottery.Client.SL
{
    public class RequestReportDataStruct
    {
        public bool _search;
        public bool firstRequest;
        public bool isSum;
        public int lowerId;
        public int page;
        public int rows;
        public string searchFiled;
        public string searchString;
        public bool sord;
        public string strEndDate;
        public string strStartDate;

        public RequestReportDataStruct()
        {
            page = 1;
            rows = 20;
            firstRequest = true;
            strStartDate = DateTime.Now.ToShortDateString();
            strEndDate = DateTime.Now.ToShortDateString();
            searchString = "";
            searchFiled = "";
        }

        public byte[] GetBytes()
        {
            var memoryStream = new MemoryStream();
            var binaryWriter = new BinaryWriter(memoryStream);
            binaryWriter.Write(page);
            binaryWriter.Write(rows);
            binaryWriter.Write(sord);
            binaryWriter.Write(lowerId);
            binaryWriter.Write(firstRequest);
            binaryWriter.Write(strStartDate);
            binaryWriter.Write(strEndDate);
            binaryWriter.Write(_search);
            binaryWriter.Write(searchString);
            binaryWriter.Write(searchFiled);
            binaryWriter.Write(isSum);
            binaryWriter.Close();
            memoryStream.Close();
            return memoryStream.ToArray();
        }
    }
}